package cn.gr.crawl.net;

import java.io.IOException;

import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import cn.gr.crawl.metadata.EditData;
import cn.gr.crawl.metadata.ListData;
import cn.gr.crawl.util.RequestUrl;

/**
 * 
 * @Description: TODO 
 * @author: henry.Tang   
 * @date:2012-5-11 下午02:37:15  
 * @version 0.1
 */
public class GRDataServiceImp extends GRDataServiceAbstract implements GRDataService{
    Logger logger = LoggerFactory.getLogger(GRDataServiceImp.class);
    @Override
    public void authorization(String userName, String password) {
        if(userName==null||password==null)
        {
            logger.error("用户名或密码不能为空！");
            return ;
        }
           try {
            int status = super.httpConnectionStatus(RequestUrl.autRequest(userName, password));
            String response=null;
            if(status == HttpStatus.SC_OK && response==null)
                 response = super.getGetMethod().getResponseBodyAsString();
            else
                logger.info(userName+":认证失败!");
        } catch (HttpException e) {
           logger.info("google服务器异常！",e);
        } catch (IOException e) {
            logger.info("google连接出现异常！",e);
        }
           
    }
    
    @Override
    public EditData dataEdit(String auth, String sid) {
        
        return null;
    }

    @Override
    public ListData dataList(String auth, String sid) {
        return null;
    }

    @Override
    public void getToken(String auth, String sid) {

    }

}
